# import matplotlib.pyplot as plt
from fractions import Fraction

class Solution:
    def maxPoints(self, points) -> int:
        if len(points) == 0:
            return 0
        dic = {}
        pLen = len(points)
        if pLen == 1:
            return 1
        for i in range(pLen-1):
            for j in range(i + 1, pLen):
                ab = line(points[i], points[j])
                if ab not in dic:
                    dic[ab] = set()
                dic[ab].add(i)
                dic[ab].add(j)
        maxNum = 2
        for p in dic.keys():
            if len(dic[p]) > maxNum:
                maxNum = len(dic[p])
        return maxNum


def line(x1, x2):
    if x1[0] == x2[0]:
        return x1[0], None
    a = Fraction(x1[1] - x2[1], x1[0] - x2[0])
    b = x1[1] - a * x1[0]
    return a, b


if __name__ == '__main__':
    so = Solution()
    s = [[560,248],[0,16],[30,250],[950,187],[630,277],[950,187],[-212,-268],[-287,-222],[53,37],[-280,-100],[-1,-14],[-5,4],[-35,-387],[-95,11],[-70,-13],[-700,-274],[-95,11],[-2,-33],[3,62],[-4,-47],[106,98],[-7,-65],[-8,-71],[-8,-147],[5,5],[-5,-90],[-420,-158],[-420,-158],[-350,-129],[-475,-53],[-4,-47],[-380,-37],[0,-24],[35,299],[-8,-71],[-2,-6],[8,25],[6,13],[-106,-146],[53,37],[-7,-128],[-5,-1],[-318,-390],[-15,-191],[-665,-85],[318,342],[7,138],[-570,-69],[-9,-4],[0,-9],[1,-7],[-51,23],[4,1],[-7,5],[-280,-100],[700,306],[0,-23],[-7,-4],[-246,-184],[350,161],[-424,-512],[35,299],[0,-24],[-140,-42],[-760,-101],[-9,-9],[140,74],[-285,-21],[-350,-129],[-6,9],[-630,-245],[700,306],[1,-17],[0,16],[-70,-13],[1,24],[-328,-260],[-34,26],[7,-5],[-371,-451],[-570,-69],[0,27],[-7,-65],[-9,-166],[-475,-53],[-68,20],[210,103],[700,306],[7,-6],[-3,-52],[-106,-146],[560,248],[10,6],[6,119],[0,2],[-41,6],[7,19],[30,250]]

    # x_values = [x[0] for x in s]
    # y_values = [x[1] for x in s]
    # plt.scatter(x_values, y_values, s=1)
    # plt.show()

    f1 = Fraction(1, 2)
    f2 = Fraction(2, 4)
    print(f1+1)

    r = so.maxPoints(s)
    print(r)
